<?php
/**
 * Author: lf
 * Blog: https://blog.szdma.com
 * Email: job@szdma.com
 * Created at: 2017-03-15 21:16.
 */

/* @var $this yii\web\View */

/* @var $content string */

use backend\assets\IndexAsset;
use backend\assets\plugins\LayerAsset;
use backend\widgets\JsBlock;
use yii\helpers\Html;
use yii\helpers\Url;

IndexAsset::register($this);
LayerAsset::register($this);
$this->title = yii::t('app', 'Backend Manage System');
$assets_url = $this->assetBundles[IndexAsset::className()]->baseUrl;

?>
<?php $this->beginPage(); ?>
    <!DOCTYPE html>
    <html>
    <head>
        <?php $this->registerMetaTag(['name' => 'charset', 'content' => Yii::$app->charset]); ?>
        <?php $this->registerMetaTag(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0']); ?>
        <?php $this->registerMetaTag(['name' => 'renderer', 'content' => 'webkit']); ?>
        <?= Html::csrfMetaTags(); ?>
        <title><?= Html::encode($this->title); ?></title>
        <?php $this->registerMetaTag(['name' => 'keywords', 'content' => 'keywords']); ?>
        <?php $this->registerMetaTag(['name' => 'description', 'content' => 'description']); ?>
        <!--[if lt IE 9]>
        <meta http-equiv="refresh" content="0;ie.html"/>
        <![endif]-->
        <?php $this->head(); ?>
        <link rel="icon" href="<?= yii::$app->getRequest()->getHostInfo(); ?>/favicon.ico" type="image/x-icon"/>
    </head>
    <body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
    <?php $this->beginBody(); ?>
    <div id="wrapper">
        <!--左侧导航开始-->
        <?= $this->render('_navbar_left', ['assets_url' => $assets_url]); ?>
        <!--左侧导航结束-->
        <!--右侧部分开始-->

        <div id="page-wrapper" class="gray-bg dashbard-1">
            <?= $this->render('_dashbard-tabs', ['assets_url' => $assets_url]); ?>
            <div class="row J_mainContent" id="content-main">
                <iframe class="J_iframe" name="iframe1" width="100%" height="100%" src="<?= Url::to(['site/main']);
                ?>" frameborder="0" data-id="<?= Url::to(['site/main']); ?>" seamless onload="addDocClickEvt(this)"></iframe>
            </div>
            <?= $this->render('_dashbard_footer', ['assets_url' => $assets_url]); ?>
        </div>
        <!--右侧部分结束-->
        <!--右侧边栏开始-->
        <?= $this->render('_right-sidebar', ['assets_url' => $assets_url]); ?>
        <!--右侧边栏结束-->
        <!--mini聊天窗口开始-->
        <? //= $this->render("_small-chat-box",['assets_url'=>$assets_url])?>
        <!--mini聊天窗口结束-->
    </div>
    <?php JsBlock::begin(); ?>
    <script>
        /*
        * iframe 点击事件冒泡到框架,解决框架外的菜单，在框架内点击无效的问题
        * 用法：
        * <iframe onload="addDocClickEvt(this)" ></iframe>
        * */
        function addEvent(o, evt, func) {
            if (o.addEventListener) o.addEventListener(evt, func, false);
            else if (o.attachEvent) o.attachEvent('on' + evt, func);
        }

        /*
        * iframe 点击事件冒泡到框架,解决框架外的菜单，在框架内点击无效的问题
        * 用法：
        * <iframe onload="addDocClickEvt(this)" ></iframe>
        * */
        function addDocClickEvt(ifr) {
            addEvent(ifr.contentWindow.document, 'click', function () {
                //隐藏右键菜单
                // $('#context-menu').hide();
                //隐藏log菜单
                if ($('.dropdown').hasClass('open')) {
                    $(".open .dropdown-toggle").dropdown('toggle');
                }
            });
        }
    </script>
    <?php JsBlock::end(); ?>
    <?php $this->endBody(); ?>
    </body>
    </html>
<?php $this->endPage(); ?>
